<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>
    <%--    静态包含--%>
    <%@include file="/pages/common/head.jsp" %>
    <style type="text/css">
        h1 {
            text-align: center;
            margin-top: 200px;
        }
    </style>
</head>
<body>

<div id="header">
    <img class="logo_img" alt="" src="static/img/logo.gif">
    <span class="wel_word">我的订单</span>
    <%@include file="/pages/common/login_success_menu.jsp" %>
</div>

<div id="main">

    <table>
        <c:if test="${not empty param.orderId}">
            <tr>
                <td>书名</td>
                <td>数量</td>
                <td>单价</td>
                <td>总价</td>
                <td>订单号</td>
                <td><a href="${requestScope.referer}">返回</a></td>
            </tr>
            <c:forEach items="${requestScope.items}" var="item">
                <tr>
                    <td>${item.name}</td>
                    <td>${item.count}</td>
                    <td>${item.price}</td>
                    <td>${item.totalPrice}</td>
                    <td>${item.orderId}</td>
                    <td><a href="orderServlet?action=receiveOrder&orderId=${item.orderId}">收货</a></td>
                </tr>
            </c:forEach>
        </c:if>
        <c:if test="${empty param.orderId}">
            <tr>
                <td>日期</td>
                <td>金额</td>
                <td>状态</td>
                <td>详情</td>
            </tr>
            <c:forEach items="${requestScope.orders}" var="order">
                <tr>
                    <td>${order.createTime}</td>
                    <td>${order.price}</td>
                    <c:if test="${order.status==0}">
                        <td>未发货</td>
                    </c:if>
                    <c:if test="${order.status==1}">
                        <td>已发货</td>
                    </c:if>
                    <c:if test="${order.status==2}">
                        <td>已完成</td>
                    </c:if>

                    <td><a href="orderServlet?action=orderDetails&orderId=${order.orderId}">查看详情</a></td>
                </tr>
            </c:forEach>
        </c:if>

    </table>


</div>
<%--静态包含页脚--%>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>